<?php
/**
 * Created by PhpStorm.
 * User: Z
 * Date: 2017/3/21
 * Time: 13:56
 */

namespace Home\Server;

/**
 * Class UserService
 * @package Home\Server
 *
 * Author: quyang
 * Date: 2017-3-21 14:24
 * Info: 创建一个类
 */
class SpeedParcelCommonService
{
    function __construct()
    {

    }

    protected $tableName = 'tp_speed_parcel_common';

    /**
     * @Desc  : 添加备注
     * @Author：quyang
     * @Param ：
     * @Time  ：2017/5/9 19:09
     * @Update：2017/5/9
     **/
    public function addCommon( $stationId , $parcelId , $common )
    {

        $data = [
            'f_station_id'  => $stationId,
            'f_parcel_id'   => $parcelId,
            'f_common'      => $common,
            'f_create_time' => time()
        ];

        return ( new \Think\Model( $this->tableName ) )->add( $data );

    }

    /**
     * @Desc  : 查询包裹备注
     * @Author：quyang
     * @Param ：
     * @Time  ：2017/5/10 10:34
     * @Update：2017/5/10
     **/
    public function queryParcelCommon( $stationId , $parcelId )
    {

        $where = "`f_parcel_id` = {$parcelId} AND `f_station_id` = {$stationId}";

        return ( new \Think\Model( $this->tableName ) )->where( $where )->select();

    }
    
}